package com.jml.代理模式.五期.service.cglib;

import java.lang.reflect.Method;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;


public class CglibMethodInterceptor implements MethodInterceptor {

    /**
     *
     * @param obj:被代理对象
     * @return  代理对象
     * @throws Throwable
     */
    @Override
    public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy)
            throws Throwable {
        System.out.println(">>>>cglib日志收集开始....");
        Object reuslt = proxy.invokeSuper(obj, args);
        System.out.println(">>>>cglib日志收集结束....");
        return reuslt;
    }
}
